package com.hh.front.controller;

import com.github.pagehelper.PageInfo;
import com.hh.common.page.CommonPage;
import com.hh.common.request.PageParamRequest;
import com.hh.common.response.CommonResult;
import com.hh.common.response.IndexProductResponse;
import com.hh.service.service.pagemanagement.ProductRecommendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("api/front/page")
public class ProductRecommendController {

    @Autowired
    private ProductRecommendService productRecommendService;

    /**
     * 商品推荐位列表
     *
     * @return
     */
    @GetMapping("/recommendList")
    public CommonResult<CommonPage<IndexProductResponse>> getRecommendList(@RequestParam("type") String type, Integer sortType,@ModelAttribute PageParamRequest pageParamRequest) {
        PageInfo<IndexProductResponse> homeRecommendResponse = this.productRecommendService.getRecommendList(type, sortType,pageParamRequest);
        return CommonResult.success(CommonPage.restPage(homeRecommendResponse));
    }


}
